package com.order.seque.config;

import com.order.seque.properties.SequeProperties;
import com.order.seque.service.SequeNo;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@ConditionalOnClass(SequeNo.class)
@EnableConfigurationProperties(SequeProperties.class)
public class SequeAutoConfigure {

  @Bean
  @ConditionalOnMissingBean
  @ConditionalOnProperty(prefix = "seque", value = "isopen", havingValue = "true")
  SequeNo sequeNoService() {
    return new SequeNo();
  }
}
